<?php
/**
 * Created by PhpStorm.
 * User: hengge
 * Date: 2018/10/30
 * Time: 10:54
 */
namespace app\admin\model;

use think\Db;
use think\Model;

class OrderModel extends Model{


    public function getOrderDataToId($id){
        $order_data = $this->alias('o')->join('user u','o.user_id=u.id')->where('o.id',$id)->field('o.*,u.user_nickname')->find();
        if(empty($order_data)){
            return false;
        }
        //收货地址
        $address_id = $order_data['province'] . ',' . $order_data['city'] . ',' . $order_data['district'];
        $address = Db::name('region')->where(['id'=>['in',$address_id]])->column('id,name');
        $order_data['address'] = implode(' ',$address) . ' ' . $order_data['address'];
        return $order_data;
    }
}